package com.lzx.hbh_system.util;


import java.util.Random;

/**
 * 获取salt值
 */
public class SaltUtil {
    public static String getSalt(int n){
        if( n == 0 ){
            n = 5;
        }
        char[] chars = ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +
                "1234567890!@#$%^&*()_+").toCharArray();
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            //Random().nextInt()返回值为[0,n)
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }
    public static Boolean macherSaltbyoldSalt(String nowloginUsernName,String redisSalt,String databaseSalt){
//        String old_secret =
        return false;
    }
    public static void main(String[] args) {
        System.out.println(getSalt(5));
    }
}

